<template>
	<view>
	    <map id="map" :style="contentStyle" 
	        subkey="S5FBZ-77XCD-GR243-PISAI-S3HXE-2RB32" scale="12" 
	        :latitude="latitude" :longitude="longitude">
	    </map>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				windowHeight: 0,
				contentStyle: '',
				latitude: 24.626431,
				longitude: 118.089958,
			}
		},
		methods: {
			
		},
		onLoad: function() {
		    let that = this;
		  
		    let windowHeight = uni.getSystemInfoSync().windowHeight;
		    that.windowHeight = windowHeight;
		    that.contentStyle = `width: 750rpx;height:${that.windowHeight}px;`;

		    let map = wx.createMapContext('map');
		    map.addVisualLayer({
		        layerId: '35db5fc54174',
		        interval: 15,
		        zIndex: 999,
		        success: function(resp) {
					console.log("创建热力图成功!");
		            console.log(resp);
		        },
		    });
			console.log("ok");
		},
		onShow: function() {
		    let that = this;
		    uni.$on('updateLocation', function(location) {
		        if (location != null) {
		            that.latitude = location.latitude;
		            that.longitude = location.longitude;
		        }
		    });
		},
		onHide: function() {
		    uni.$off('updateLocation');
		    
		}
	}
</script>

<style>

</style>
